﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WenABP.Customer.Domain.Data;
using Volo.Abp.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

namespace WenABP.Customer.EntityFrameworkCore.Migration
{
    [Dependency(ServiceLifetime.Transient,ReplaceServices =true)]
    [ExposeServices(typeof(ICustomerStoreSchemaMigrator))]
    public class EFCustomerDBSchemMigrator : ICustomerStoreSchemaMigrator
    {
        private readonly CustomerDbMigrationContext _dbContext;

        public EFCustomerDBSchemMigrator(CustomerDbMigrationContext dbContext)
        {
            _dbContext = dbContext;
        }

        public async Task MigrateAsync()
        {
            await _dbContext.Database.MigrateAsync();
        }
    }
}
